#ifndef _RETRO_LISTBASE
#define _RETRO_LISTBASE

namespace Retro
{
  namespace Creator
  {
    namespace GUI
    {
      class ListBase : public Control
      {
      private:
        INT   itemCount;
        INT   itemHeight;

      protected:
        ScrollInfo  scroll;

        virtual VOID  paintItem(
          Gdip::Graphics&     g,
          const Gdip::Rect&   bounds,
          INT                 index) = 0;
        virtual VOID  paintForeground(
          Gdip::Graphics&     g,
          const Gdip::Rect&   bounds) = 0;

        INT   calcScrollPos(INT sbRequest, INT nBar, INT current);

        VOID  onControlPaint(Controls::ControlPaintEvent& iEvent);
        VOID  onMouseWheel(Event::MouseWheelEvent& iEvent);
        VOID  onVScroll(Event::ScrollEvent& iEvent);
        VOID  onSize(Event::SizeEvent& iEvent);

      public:
        VOID  invalidateItem(INT iIndex);

        INL INT   getItemCount()
        {
          return itemCount;
        }
        VOID      setItemCount(INT value);

        INL INT   getItemHeight()
        {
          return itemHeight;
        }
        INL VOID  setItemHeight(INT value)
        {
          itemHeight = value;
        }

        INLC Geom::Point& getScroll()
        {
          return scroll.pos;
        }

        ListBase();
      };
    } // namespace GUI
  } // namespace Creator
} // namespace Retro

#endif
